<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Ant Design Mobile | A Mobile Design Specification</title>
    <link
      rel="icon"
      href="https://zos.alipayobjects.com/rmsportal/wIjMDnsrDoPPcIV.png?x-oss-process=image/resize,h_32"
      type="image/x-icon"
    />
    {% if not isDev %}
    <link rel="stylesheet" type="text/css" href="{{ root }}index-1.css" />
    <link rel="stylesheet" type="text/css" href="{{ root }}index-2.css" />
    {% endif %}
    <link rel="stylesheet" href="{{ root }}index.css">
    <script src="https://polyfill.alicdn.com/polyfill.min.js?features=default,es2015,Intl"></script>

    <script>
      

      (function() {
        function checkIfMobile() {
          var ua = window.navigator.userAgent.toLowerCase();
          if (ua.indexOf('android') !== -1 || ua.indexOf('iphone') !== -1) {
            return true;
          }
          return false;
        }
        function checkIfCn() {
          return window.navigator.language.toLowerCase() === 'zh-cn'; // wtf safari is 'zh-CN', while chrome and other is 'zh-CN'
        }
        if (checkIfMobile()) {
          var url = location.port
            ? 'http://127.0.0.1:8002/'
            : window.location.origin + '/';
          if (checkIfCn()) {
            url = url + '?lang=zh-CN';
          } else {
            url = url + '?lang=en-US';
          }
          return (location.href = url);
        }
        function isLocalStorageNameSupported() {
          const testKey = 'test';
          const storage = window.localStorage;
          try {
            storage.setItem(testKey, '1');
            storage.removeItem(testKey);
            return true;
          } catch (error) {
            return false;
          }
        }
        // 优先级提高到所有静态资源的前面，语言不对，加载其他静态资源没意义
        var pathname = location.pathname;
        function isZhCN(pathname) {
          return /-cn\/?$/.test(pathname);
        }
        function getLocalizedPathname(path, zhCN) {
          var pathname = path.startsWith('/') ? path : '/' + path;
          if (!zhCN) {
            // to enUS
            return /\/?index-cn/.test(pathname)
              ? '/'
              : pathname.replace('-cn', '');
          } else if (pathname === '/') {
            return '/index-cn';
          } else if (pathname.endsWith('/')) {
            return pathname.replace(/\/$/, '-cn/');
          }
          return pathname + '-cn';
        }
        // 首页无视链接里面的语言设置 https://github.com/ant-design/ant-design/issues/4552
        if (
          isLocalStorageNameSupported() &&
          (pathname === '/' || pathname === '/index-cn')
        ) {
          var lang =
            (window.localStorage && localStorage.getItem('locale')) ||
            (window.navigator.language.toLowerCase() === 'zh-cn'
              ? 'zh-CN'
              : 'en-US');
          if ((lang === 'zh-CN') !== isZhCN(pathname)) {
            location.pathname = getLocalizedPathname(
              pathname,
              lang === 'zh-CN'
            );
          }
        }
        document.documentElement.className += isZhCN(pathname)
          ? 'zh-cn'
          : 'en-us';
      })();
    </script>
    <!-- Global Site Tag (gtag.js) - Google Analytics -->
    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script
      async
      src="https://www.googletagmanager.com/gtag/js?id=UA-72788897-9"
    ></script>
    <script>
      if (!location.port) {
        window.dataLayer = window.dataLayer || [];
        function gtag() {
          dataLayer.push(arguments);
        }
        gtag('js', new Date());
        gtag('config', 'UA-72788897-9');
      }
    </script>
  </head>
  <body>
    <div id="react-content"></div>
    
    <!-- <script src="{{ root }}common.js"></script> -->
    <script src="{{ root }}index.js"></script>
  </body>
</html>
